<!--  -->
<template>
  <div class="app-container">
    <el-form label-width="100px" :inline="false" size="normal">
      <el-form-item label="客服热线：">
        <el-input v-model="phoneNumber" style="width:300px"></el-input>
      </el-form-item>
      <el-form-item label="客服微信：">
        <el-input v-model="phoneNumber" style="width:300px"></el-input>
      </el-form-item>
      <el-form-item label="常见问题：">
        <div v-for="(item, index) in questions" :key="index">
          <q-box :index="index" :item="item" @addQue='addQue'></q-box>
        </div>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="">保存</el-button>
        <el-button>重置</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
import qBox from './question.vue'
export default {
  name: "customer",
  data() {
    return {
      phoneNumber: "",
      questions: [{ q: "12312313", a: "123232113" }]
    };
  },
  components:{
    qBox
  },
  methods: {
    addQue(){
      var n=this.questions.length-1;
      if(this.questions[n].q!==''&&this.questions[n].a!=='')this.questions.push({ q: "", a: "" })
      else{
        this.$message.error('请完善问答后再添加新问题')
      }
    }
  },
};
</script>
<style></style>
